#include<iostream>

double power(double x, int n){
    if (n == 0) 
        return 1;
    double p = power(x, n/2); //向下取整
    if (n % 2 == 0)
        return p * p;
    else
        return p * p * x;
}

int main(){
    double x;
    int n;

    std::cout << "请输入底数x:";
    std::cin >> x;
    std::cout << "请输入幂次n:";
    std::cin >> n;
    std::cout << x << "的" << n << "次幂是:" << power(x,n) << std::endl;

    return 0;
}
